package com.sjgtw.cloud.app.riskReporting.service.impl;

import com.sjgtw.cloud.app.riskReporting.domain.RiskTracking;
import com.sjgtw.cloud.app.riskReporting.mapper.RiskTrackingMapper;
import com.sjgtw.cloud.app.riskReporting.service.IRiskTrackingService;
import com.sjgtw.cloud.common.core.utils.DateUtils;
import com.sjgtw.cloud.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 风险跟踪Service业务层处理
 * 
 * @author lvyoufang
 * @date 2024-05-31
 */
@Service
public class RiskTrackingServiceImpl implements IRiskTrackingService 
{
    @Autowired
    private RiskTrackingMapper riskTrackingMapper;

    /**
     * 查询风险跟踪
     * 
     * @param id 风险跟踪主键
     * @return 风险跟踪
     */
    @Override
    public RiskTracking selectRiskTrackingById(Long id)
    {
        return riskTrackingMapper.selectRiskTrackingById(id);
    }

    /**
     * 查询风险跟踪列表
     * 
     * @param riskTracking 风险跟踪
     * @return 风险跟踪
     */
    @Override
    public List<RiskTracking> selectRiskTrackingList(RiskTracking riskTracking)
    {
        return riskTrackingMapper.selectRiskTrackingList(riskTracking);
    }

    /**
     * 新增风险跟踪
     * 
     * @param riskTracking 风险跟踪
     * @return 结果
     */
    @Override
    public int insertRiskTracking(RiskTracking riskTracking)
    {
        riskTracking.setCreateBy(SecurityUtils.getUsername());
        riskTracking.setCreateTime(DateUtils.getNowDate());
        riskTracking.setCreateUserId(SecurityUtils.getUserId());
        return riskTrackingMapper.insertRiskTracking(riskTracking);
    }

    /**
     * 修改风险跟踪
     * 
     * @param riskTracking 风险跟踪
     * @return 结果
     */
    @Override
    public int updateRiskTracking(RiskTracking riskTracking)
    {
        riskTracking.setUpdateBy(SecurityUtils.getUsername());
        riskTracking.setUpdateTime(DateUtils.getNowDate());
        return riskTrackingMapper.updateRiskTracking(riskTracking);
    }

    /**
     * 批量删除风险跟踪
     * 
     * @param ids 需要删除的风险跟踪主键
     * @return 结果
     */
    @Override
    public int deleteRiskTrackingByIds(String[] ids)
    {
        return riskTrackingMapper.deleteRiskTrackingByIds(ids);
    }

    /**
     * 删除风险跟踪信息
     * 
     * @param id 风险跟踪主键
     * @return 结果
     */
    @Override
    public int deleteRiskTrackingById(Long id)
    {
        return riskTrackingMapper.deleteRiskTrackingById(id);
    }
}
